﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using ARR.Entities;
using ARR.Entities.Gateways;

namespace ARR.Services
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IArticlesService" in both code and config file together.
    [ServiceContract]
    public interface IArticlesService
    {
        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<Article> GetAll(int rangeReviewId, int? categoryId, bool lazyLoad);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void UpdateStatus(int rangeReviewId);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<Article> GetByCategory(int rangeReviewId, int? categoryId, bool lazyLoad);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<Article> SearchArticles(string criteria, int rangeReviewId);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        Article GetByID(int articleID);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<TempArticle> GetTempArticlesByIds(IEnumerable<int> listIds);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<TempArticleSale> GetTempArticleSalesByIds(IEnumerable<int> listIds);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void SaveTempArticles(List<TempArticle> tempArticles);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void SaveArticles(List<Article> articles);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void Join(int[] articleIds, int targetArticleId);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void Split(int sourceArticleId, List<Article> articles);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void DeleteTempArticles(List<TempArticle> tempArticles);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void UpdateTempArticlesWithCategoryMatch(int categoryId, string[] originalCategories);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void SaveTempArticleSales(List<TempArticle> tempArticles);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void UpdateTempArticleSalesArticleIds(int rangeReviewId);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<TempArticle> GetSameStoreArticles(int sameStoreId);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<TempArticleSale> GetTempArticleSalesDuplicates();

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<ArticleSale> GetAllSales(int rangeReviewId, int? categoryId = null);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void SaveSales(List<ArticleSale> sales);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<CategoryMargin> GetArticleSalesCategoryMargins(int rangeReviewId);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<TempPIDifference> GetTempPIDifferencesByIds(IEnumerable<int> listIds);

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        List<TempPIDifference> GetTempPIDifferencesDuplicates();

        [OperationContract]
        [FaultContract(typeof(ARRExceptionDetail))]
        void SaveTempPIDifferences(List<TempPIDifference> diffs);
    }
}
